home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 4
/
FM Towns Free Software Collection 4 - Disc 1.iso
/
t_os
/
rom
/
rom.c
< prev
next >
Wrap
Text File
|
1991-10-18
|
5KB
|
188 lines
/********************************************************************/
/* */
/* rom.c -- functions to display image data in system ROM */
/* */
/* written by タケ (NAA01070) */
/* */
/********************************************************************/
#include <egb.h>
#include <rom.h>
#define SYSTEM_ROM_DATA 0x108
#define OFF_GEAR_ICON 0x28000
#define OFF_TOP_LINE 0x30838
#define OFF_KEYBOARD 0x30859
#define OFF_WINDOW 0x34639
#define OFF_KANJI_BUTTON 0x3490f
#define OFF_SIZE_BUTTON 0x34b5b
#define OFF_SHADOW_V 0x34bcd
#define OFF_SHADOW_H 0x34c5c
#define OFF_CALCULATOR 0x34e00
#define OFF_BUTTON 0x37ec0
#define OFF_OPENING 0x38000
#define OFF_SYS_ICON 0x3b000
#define PSET 0
#define OR 2
#define BLUE 9
#define RED 10
#define GREEN 12
void ROM_putGearIcon(char *work, char *para, int sw, int n,
int x, int y)
{
DWORD(para + 0) = OFF_GEAR_ICON + ((W_GEAR_ICON + 7) / 8)
* L_GEAR_ICON * ((n - 1) * 2 + sw);
WORD(para + 4) = SYSTEM_ROM_DATA;
WORD(para + 6) = x;
WORD(para + 8) = y;
WORD(para + 10) = x + W_GEAR_ICON - 1;
WORD(para + 12) = y + L_GEAR_ICON - 1;
EGB_putBlockColor(work, 0, para);
}
void ROM_putTopLine(char *work, char *para, int x, int y)
{
DWORD(para + 0) = OFF_TOP_LINE;
WORD(para + 4) = SYSTEM_ROM_DATA;
WORD(para + 6) = x;
WORD(para + 8) = y;
WORD(para + 10) = x + W_TOP_LINE - 1;
WORD(para + 12) = y + L_TOP_LINE - 1;
EGB_putBlockColor(work, 0, para);
}
void ROM_putKeyboard(char *work, char *para, int n, int x, int y)
{
DWORD(para + 0) = OFF_KEYBOARD + ((W_KEYBOARD + 7) / 8)
* L_KEYBOARD * (n - 1);
WORD(para + 4) = SYSTEM_ROM_DATA;
WORD(para + 6) = x;
WORD(para + 8) = y;
WORD(para + 10) = x + W_KEYBOARD - 1;
WORD(para + 12) = y + L_KEYBOARD - 1;
EGB_putBlockColor(work, 0, para);
}
void ROM_putWindow(char *work, char *para, int x, int y)
{
DWORD(para + 0) = OFF_WINDOW;
WORD(para + 4) = SYSTEM_ROM_DATA;
WORD(para + 6) = x;
WORD(para + 8) = y;
WORD(para + 10) = x + W_WINDOW - 1;
WORD(para + 12) = y + L_WINDOW - 1;
EGB_putBlockColor(work, 0, para);
}
void ROM_putKanjiButton(char *work, char *para, int n, int x, int y)
{
DWORD(para + 0) = OFF_KANJI_BUTTON + ((W_KANJI_BUTTON + 7) / 8)
* L_KANJI_BUTTON * (n - 1);
WORD(para + 4) = SYSTEM_ROM_DATA;
WORD(para + 6) = x;
WORD(para + 8) = y;
WORD(para + 10) = x + W_KANJI_BUTTON - 1;
WORD(para + 12) = y + L_KANJI_BUTTON - 1;
EGB_putBlockColor(work, 0, para);
}
void ROM_putSizeButton(char *work, char *para, int n, int x, int y)
{
DWORD(para + 0) = OFF_SIZE_BUTTON + ((W_SIZE_BUTTON + 7) / 8)
* L_SIZE_BUTTON * (n - 1);
WORD(para + 4) = SYSTEM_ROM_DATA;
WORD(para + 6) = x;
WORD(para + 8) = y;
WORD(para + 10) = x + W_SIZE_BUTTON - 1;
WORD(para + 12) = y + L_SIZE_BUTTON - 1;
EGB_putBlockColor(work, 0, para);
}
void ROM_putShadowV(char *work, char *para, int x, int y)
{
DWORD(para + 0) = OFF_SHADOW_V;
WORD(para + 4) = SYSTEM_ROM_DATA;
WORD(para + 6) = x;
WORD(para + 8) = y;
WORD(para + 10) = x + W_SHADOW_V - 1;
WORD(para + 12) = y + L_SHADOW_V - 1;
EGB_putBlockColor(work, 0, para);
}
void ROM_putShadowH(char *work, char *para, int x, int y)
{
DWORD(para + 0) = OFF_SHADOW_H;
WORD(para + 4) = SYSTEM_ROM_DATA;
WORD(para + 6) = x;
WORD(para + 8) = y;
WORD(para + 10) = x + W_SHADOW_H - 1;
WORD(para + 12) = y + L_SHADOW_H - 1;
EGB_putBlockColor(work, 0, para);
}
void ROM_putCalculator(char *work, char *para, int x, int y)
{
DWORD(para + 0) = OFF_CALCULATOR;
WORD(para + 4) = SYSTEM_ROM_DATA;
WORD(para + 6) = x;
WORD(para + 8) = y;
WORD(para + 10) = x + W_CALCULATOR - 1;
WORD(para + 12) = y + L_CALCULATOR - 1;
EGB_putBlockColor(work, 0, para);
}
void ROM_putButton(char *work, char *para, int n, int x, int y)
{
DWORD(para + 0) = OFF_BUTTON + 8 + (8 + ((W_BUTTON + 7) / 8)
* L_BUTTON) * (n - 1);
WORD(para + 4) = SYSTEM_ROM_DATA;
WORD(para + 6) = x;
WORD(para + 8) = y;
WORD(para + 10) = x + W_BUTTON - 1;
WORD(para + 12) = y + L_BUTTON - 1;
EGB_putBlockColor(work, 0, para);
}
void ROM_putOpening(char *work, char *para, int x, int y)
{
int i, j;
EGB_writeMode(work, OR);
for (i = 0; i < L_OPENING; ++i)
for (j = 0; j < 3; ++j) {
switch(j) {
case 0:
EGB_color(work, 0, BLUE); break;
case 1:
EGB_color(work, 0, RED); break;
default:
EGB_color(work, 0, GREEN);
}
DWORD(para + 0) = OFF_OPENING + 4 + ((W_OPENING + 7) / 8)
* (3 * i + j);
WORD(para + 4) = SYSTEM_ROM_DATA;
WORD(para + 6) = x;
WORD(para + 8) = y + i;
WORD(para + 10) = x + W_OPENING - 1;
WORD(para + 12) = y + i;
EGB_putBlockColor(work, 0, para);
}
EGB_writeMode(work, PSET);
}
void ROM_putSysIcon(char *work, char *para, int sw, int n,
int x, int y)
{
DWORD(para + 0) = OFF_SYS_ICON + ((W_SYS_ICON + 7) / 8)
* L_SYS_ICON * ((n - 1) * 2 + sw);
WORD(para + 4) = SYSTEM_ROM_DATA;
WORD(para + 6) = x;
WORD(para + 8) = y;
WORD(para + 10) = x + W_SYS_ICON - 1;
WORD(para + 12) = y + L_SYS_ICON - 1;
EGB_putBlockColor(work, 0, para);
}